﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Resource_Count : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        MysqlHelp FileTypeCount = new MysqlHelp();
        DataTable DTCount = new DataTable();
        string sqlstr = "select * from filetype";
        DTCount = FileTypeCount.GetDatabysql(sqlstr);
        int ftCount = DTCount.Rows.Count;
        int audio = 0, text = 0, video = 0, software = 0, other = 0, ppt = 0, pictures = 0;
        DataTable DTrecall = new DataTable();
        for (int i = 1; i <= ftCount; i++)
        {
            MysqlHelp dataprovider = new MysqlHelp();
            string strSQL = string.Format("SELECT * FROM resource WHERE filetype = {0}", i);
            DTrecall = dataprovider.GetDatabysql(strSQL);
            switch (DTCount.Rows[i - 1]["describe"].ToString())
            {
                case "文本": text += DTrecall.Rows.Count; break;
                case "音频": audio += DTrecall.Rows.Count; break;
                case "课件": ppt += DTrecall.Rows.Count; break;
                case "软件": software += DTrecall.Rows.Count; break;
                case "其它": other += DTrecall.Rows.Count; break;
                case "图片": pictures += DTrecall.Rows.Count; break;
                case "视频": video += DTrecall.Rows.Count; break;
            }
        }
        Response.Write("文本：" + text + "个<br>");
        Response.Write("音频：" + audio + "个<br>");
        Response.Write("课件：" + ppt + "个<br>");
        Response.Write("软件：" + software + "个<br>");
        Response.Write("图片：" + pictures + "个<br>");
        Response.Write("视频：" + video + "个<br>");
        Response.Write("其它：" + other + "个<br>");
    }
}
